package com.gitee.cui.netty.decoder;

import com.gitee.cui.util.Logger;
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.MessageToMessageDecoder;

import java.util.List;

/**
 * 一种Java POJO 对象解码转换为另一种Java POJO对象，泛型为入站数据类型
 * @author cuiqingqiang
 * @version 1.0
 * @date 2021/10/22 21:11
 **/
public class Integer2StringDecoder extends MessageToMessageDecoder<Integer> {
    @Override
    protected void decode(ChannelHandlerContext ctx, Integer msg, List<Object> out) throws Exception {
        String s = String.valueOf(msg);
        Logger.info("解码出一个字符串：" + s);
        out.add(s);
    }
}
